import React, { Component } from 'react';
import CommentHeader from './header/Header';
import CommentList from './list/List';
class CommentIndex extends Component {
    state = { 
      list: []
    } 
    updateList = (msg) => {
      // const list = this.state.list.concat([msg])
      const list = [...this.state.list]
      list.push(msg)
       this.setState({
          list
       })
    }
    render() { 
        return (<div>
        <h3>7.2.1 评论案例</h3>
          <CommentHeader updateList={this.updateList} />
          <CommentList list={this.state.list} />
        </div>);
    }
}
 
export default CommentIndex;